package com.ticket.controller.api;

import com.ticket.entity.Feedback;
import com.ticket.service.IFeedbackService;
import com.ticket.utils.Result;
import com.ticket.utils.UserContext;
import com.ticket.vo.FeedbackVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/feedbacks")
public class FeedbackController {

    @Autowired
    private IFeedbackService feedbackService;

    @GetMapping
    public Result<List<Feedback>> getFeedbacks() {
        Long userId = UserContext.getCurrentUserId();
        return Result.success(feedbackService.getUserFeedbacks(userId));
    }

    @PostMapping
    public Result<Void> createFeedback(@RequestBody FeedbackVO feedbackVO) {
        Long userId = UserContext.getCurrentUserId();
        feedbackService.createFeedback(userId, feedbackVO);
        return Result.success();
    }
} 